import java.io.File;

public class ExtractFileName {
    public static String extractFileName(String filePath) {
        File file = new File(filePath);
        String fileNameWithExtension = file.getName();
        int lastDotIndex = fileNameWithExtension.lastIndexOf(".");
        if (lastDotIndex != -1) {
            String fileName = fileNameWithExtension.substring(0, lastDotIndex);
            return fileName;
        }
        return fileNameWithExtension;
    }

}
